package com.mlf.abstractFactory.spring.ui;

import com.mlf.abstractFactory.Button;
import com.mlf.abstractFactory.Checkbox;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class UIService {
    @Autowired
    private  ThemeService themeService;


    // 动态渲染UI

    public void renderUI(String themeName) {
        ThemeFactory factory = themeService.getThemeFactory(themeName);

        Button btn = factory.createButton();
        Checkbox cb = factory.createCheckbox();

        btn.render();
        cb.check();

        System.out.println("使用主题: " + themeName);
    }
}